package cn.iocoder.yudao.module.ride.dal.mysql.orders;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ride.dal.dataobject.orders.OrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ride.controller.admin.orders.vo.*;

/**
 * 订单管理 Mapper
 *
 * @author 小小胡
 */
@Mapper
public interface OrderMapper extends BaseMapperX<OrderDO> {

    default PageResult<OrderDO> selectPage(OrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
                .eqIfPresent(OrderDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderDO::getOrderStatus, reqVO.getOrderStatus())
                .eqIfPresent(OrderDO::getFromId, reqVO.getFromId())
                .eqIfPresent(OrderDO::getPayId, reqVO.getPayId())
                .eqIfPresent(OrderDO::getDriverId, reqVO.getDriverId())
                .orderByDesc(OrderDO::getOrderId));
    }

}